<template>
  <div class="person">
    <a href="#">
      <img class="small" src="../assets/head.jpg" />
    </a>
    <div class="msg" @click="show = true" @blur="display" tabindex="1">
      <span class="name">黎大王</span>
      <em></em>
    </div>
    <transition enter-active-class="animated fadeInDown">
      <div class="msgConten" v-if="show">
        <div class="content">
          <div class="msg-header">
            <div class="picname">
              <img class="headpic" src="../assets/head.jpg" />
              <span>黎大王</span>
              <button>签到</button>
            </div>
            <div class="social">
              <span> <em>3</em>动态 </span>
              <span> <em>3</em>关注 </span>
              <span> <em>0</em>粉丝 </span>
            </div>
          </div>
          <div class="msg-list">
            <div>
              <img src="../assets/member.png" />
              <span>会员中心</span>
              <span class="intro">未订购</span>
            </div>
            <div>
              <img src="../assets/level.png" />
              <span>等级</span>
              <span class="intro">Lv.7</span>
            </div>
            <div class="border-bottom">
              <img src="../assets/buy.png" />
              <span>积分商城</span>
              <span class="intro">12积分</span>
            </div>
            <div>
              <img src="../assets/setting.png" />
              <span>个人信息设置</span>
            </div>
            <div class="border-bottom">
              <img src="../assets/phone.png" />
              <span>绑定社交账号</span>
            </div>

            <div>
              <img src="../assets/end.png" />
              <span>退出登录</span>
            </div>
          </div>
        </div>
      </div>
    </transition>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: false,
    };
  },
  methods: {
    display() {
      this.show = false;
    },
  },
};
</script>
<style lang="less">
.person {
  font-size: 13px;
  display: flex;
  position: absolute;
  left: 61%;
  -webkit-app-region: none;
  .small {
    width: 25px;
    height: 25px;
    border-radius: 25px;
    vertical-align: top;
  }
  .msg {
    display: flex;
    outline: none;
    .name {
      color: #eec1c1;
      font-size: 13px;
      line-height: 25px;
      width: 75px;
      white-space: nowrap;
      display: inline-block;
      text-overflow: ellipsis;
      overflow: hidden;
      margin-left: 5px;
    }
    em {
      position: relative;
      top: 10px;
      left: 10px;
      display: block;
      margin-left: 10px;
      width: 0px;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-top: 5px solid #eec1c1;
    }
    &:hover .name {
      color: white;
    }
    &:hover em {
      border-top: 5px solid white;
    }
  }
  .msgConten {
    position: absolute;
    top: 26px;
    width: 270px;
    z-index: 111111111111;
    -webkit-app-region: none;
    .content {
      width: 100%;
      background-color: white;
      box-shadow: 0px 2px 4px rgb(225, 225, 226);
      border-radius: 5px;
      .msg-header {
        display: flex;
        flex-direction: column;
        font-size: 15px;
        padding: 10px 20px;
        box-sizing: border-box;
        border-bottom: 1px solid rgb(233, 233, 233);
        text-align: left;
        .picname {
          display: flex;
          align-items: center;
          span {
            line-height: 40px;
            padding: 0 5px;
            width: 120px;
            overflow: hidden;
          }
          button {
            font-size: 12px;
            border: 1px solid rgb(236, 237, 238);
            background-color: white;
            text-align: right;
            width: 60px;
            padding: 4px 10px;
            background-image: url("../assets/sign.png");
            background-size: 15px 18px;
            background-repeat: no-repeat;
            background-position: 5px 2px;
            border-radius: 5px;
            outline: none;
          }
          img {
            width: 40px;
            height: 40px;
            border-radius: 40px;
            vertical-align: top;
          }
        }
        .social {
          width: 100%;
          display: flex;
          text-align: center;
          margin: 10px 0;
          span {
            flex: 1;
            border-right: 1px solid rgb(225, 225, 226);

            em {
              display: block;
              font-weight: bolder;
              margin: 5px;
            }
            &:last-child {
              border-right: none;
            }
          }
        }
        border-bottom: 1px solid rgb(233, 233, 233);
      }
      .msg-list {
        div {
          color: black;
          padding: 8px 20px;
          height: 40px;
          text-align: left;
          line-height: 20px;
          position: relative;
          &::after {
            content: "";
            position: absolute;
            background-image: url("../assets/right.png");
            top: 13px;
            right: 20px;
            width: 10px;
            height: 10px;
            background-size: cover;
            opacity: 0.5;
            z-index: 999;
          }
          &:hover {
            background-color: rgb(236, 237, 238);
            cursor: pointer;
          }
        }
        span {
          padding: 0 5px;
          overflow: hidden;
          box-sizing: border-box;
        }
        img {
          width: 20px;
          height: 20px;
          opacity: 0.5;
          vertical-align: top;
          margin-right: 10px;
        }
        .intro { 
          float: right;
          position: relative;
          right: 10px;
          color: rgb(136, 136, 136);
        }
        .border-bottom {
          border-bottom: 1px solid rgb(233, 233, 233);
        }
      }
    }
    &::before {
      content: "";
      display: block;
      margin-left: 50px;
      width: 0px;
      border-bottom: 11px white solid;
      border-left: 10px transparent solid;
      border-right: 10px transparent solid;
    }
  }
}
</style>
